home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Software Contest 3 / FM Towns Software Contest 3.iso / exp / astral / a1 / game / source / sinout.c < prev    next >
C/C++ Source or Header  |  1994-01-07  |  610b  |  32 lines

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. void main(void)
  5. {
  6.     double i,w;
  7.     
  8.     printf("#ifdef MAIN\n");
  9.     
  10.     printf("int sin_data[256]={\n");
  11.     for(i=0;i<255;i++){
  12.         w=sin(i/128*PI)*128;
  13.         printf("    %3d,\n",(int)(w));
  14.     }
  15.     w=sin((double)(255)/128*PI)*128;
  16.     printf("    %3d\n};\n",(int)(w));
  17.     
  18.     printf("int cos_data[256]={\n");
  19.     for(i=0;i<255;i++){
  20.         w=cos(i/128*PI)*128;
  21.         printf("    %3d,\n",(int)(w));
  22.     }
  23.     w=cos((double)(255)/128*PI)*128;
  24.     printf("    %3d\n};\n",(int)(w));
  25.     
  26.     printf("#else\n");
  27.     printf("extern int sin_data[256];\n");
  28.     printf("extern int cos_data[256];\n");
  29.     printf("#endif");
  30.  
  31. }
  32.